nlp_architect.server package

Submodules

nlp_architect.server.serve module

REST Server to respond to different API requests

nlp_architect.server.serve.get_index()[source]
nlp_architect.server.serve.get_paragraphs()[source]
nlp_architect.server.serve.inference(request, body, response)[source]

Makes an inference to a certain model

nlp_architect.server.serve.prefetch_models()[source]
nlp_architect.server.serve.static()[source]

Statically serves a directory to client

nlp_architect.server.service module

Service file used to import different features for server

class nlp_architect.server.service.Service(service_name)[source]

Bases: object

Handles loading and inference using specific models

get_paragraphs()[source]
get_service_inference(docs, headers)[source]

get parser response from service API

Parameters:
  • headers (list(str)) – the headers of the request
  • docs – input received from the request
Returns:

the service API output

load_service(name)[source]

Initialize and load service from input given name, using “services.json” properties file

Parameters:name (str) – The name of service to upload using server
Returns:The loaded service
nlp_architect.server.service.extract_module_name(model_path)[source]

Extract the module’s name from path

Parameters:model_path (str) – the module’s class path
Returns:the modules name
Return type:str
nlp_architect.server.service.format_response(resp_format, parsed_doc)[source]

Transform string of server’s response to the requested format

Parameters:
  • resp_format (str) – the desired response format
  • parsed_doc – the server’s response
Returns:

formatted response

nlp_architect.server.service.package_home(gdict)[source]

help function for running paths from out-of-class scripts

nlp_architect.server.service.parse_headers(req_headers)[source]

Load headers from request to dictionary

Parameters:req_headers (dict) – the request’s headers
Returns:dictionary hosting the request headers
Return type:dict
nlp_architect.server.service.set_headers(res)[source]

set expected headers for request (CORS)

Parameters:res (falcon.Response) – the request

Module contents